
package actions;

import dao.InexistantEntityException;
import entities.Client;
import gestion.GestionnaireRemote;

/**
 *
 * @author Alex
 */
public class Connexion extends MiagetestAction {

    private Integer idClient;

    public void setIdClient(Integer idClient) {
        this.idClient = idClient;
    }

    @Override
    public String execute() {

        GestionnaireRemote gestionnaire = lookupGestionnaireRemote();

        try
        {
            Client client = (Client) gestionnaire.get(Client.class, idClient);
            saveSessionClientId(client.getId());
        }
        catch(InexistantEntityException e)
        {
            setMessage(e.toString());
        }

        return SUCCESS;
    }

}
